#pragma once

#include <string>
#include <boost/exception/all.hpp>
#include <exception>

#define THROW(x) BOOST_THROW_EXCEPTION(x)

///-------Helper Class to formate SourceCode in error messages--------
class ShaderSource
{
public:
	ShaderSource(std::string Source);
	friend inline std::ostream& operator<<(std::ostream &Stream, const ShaderSource& Source);
private:
	std::string m_Source;
};

inline std::ostream& operator<<(std::ostream &Stream, const ShaderSource& Source)
{
	return Stream << Source.m_Source;
}
//___________________________________________________________________



//---------------------- file info -------------------------
class Filename
{
public:
	Filename(std::string Filename);
	
	std::string m_Filename;
	std::string m_AbsFilename;
};

inline std::ostream& operator<<(std::ostream &Stream, const Filename& file)
{
	return Stream << file.m_Filename << " loaded at: " << file.m_AbsFilename;
}
//_____________________________________________________

typedef boost::error_info<struct tag_Error, std::string>			ErrorInfo; //short Text
typedef boost::error_info<struct tag_Description, std::string>		DescriptionInfo; //long Text
typedef boost::error_info<struct tag_Filename, Filename>			FilenameInfo;
typedef boost::error_info<struct tag_ModelFilename, Filename>		ModelFilenameInfo;
typedef boost::error_info<struct tag_VertexSource, ShaderSource>	VertexSourceInfo;
typedef boost::error_info<struct tag_FragmentSource, ShaderSource>	FragmentSourceInfo;

class Exception : public boost::exception, public std::exception
{
public:
	Exception(std::string Text):m_Text(Text){}
	std::string m_Text;
	const char* what() const override{ return m_Text.c_str(); }
};
